	
	<?php
		include_once("adb.php");
	
		class schools extends adb
		{
			function schools()
			{
				adb::adb();
			}
			/**
			*query all vaccines in the table and store the dataset in $this->result	
			*@return if successful true else false
			*/
		
			function get_all_schools()
			{
				$query="select school_id,school_name,sch_notes,community_id from schools";
				return $this->query($query);
			}
		
			function add_school($school_name, $sch_notes,$community_id)
			{
				//write the SQL query and call $this->query()
				$query = "insert into schools set  school_name = '$school_name', sch_notes = '$sch_notes',
				community_id = '$community_id' ";
				return  $this -> query($query);
			}

			/**
			*updates the record identified by id 
			*/
			function update_school($school_id, $school_name,$sch_notes,$community_id)
			{
				//write the SQL query and call $this->query()
				$query = "update schools set school_name = '$school_name',
				sch_notes = '$sch_notes',community_id = '$community_id' where school_id = '$school_id'";
				if(!$this -> query($query))
				{
					return false;
				}
					return true;	 
			}

			function search_school($name)
			{
				$query = "select * from schools where school_name like '%$name%'";
				
				return $this -> query($query);
				
			}

			function delete_school($school_id)
			{
                $query = "delete from schools where school_id='$school_id'";

                return $this -> query($query);
			}

			function get_school($id)
			{
				$query = "select * from schools where school_id = $id";
				if(!$this -> query($query))
				{
					return false;
				}
					return $this -> fetch();
			}
		}
		

		?>
